package com.bw.mvvm.network.load;

import com.bw.mvvm.network.inteceptor.TokenInterceptor;

import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class TokenImpl extends BaseImpl{
    Retrofit retrofit;
    @Override
    public Retrofit getRetrofit() {
        OkHttpClient.Builder builder = createOkHttpBuilder();
        builder.addInterceptor(new TokenInterceptor());

        Retrofit.Builder retrofitBuilder = new Retrofit.Builder();
        retrofitBuilder.baseUrl(Api.baseUrl);
        retrofitBuilder.client(builder.build());
        retrofitBuilder.addConverterFactory(GsonConverterFactory.create());
        retrofitBuilder.addCallAdapterFactory(RxJava2CallAdapterFactory.create());
        retrofit = retrofitBuilder.build();
        return retrofit;
    }
}
